-
Notifications
You must be signed in to change notification settings - Fork 12
Forward Felt new window requests via IPC. #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: enterprise-main
Are you sure you want to change the base?
Conversation
0beecbc to
45fa1e2
Compare
1rneh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, overall the changes on the js side look good!
Two things I noticed:
- Most of these changes still need some
#ifdef MOZ_ENTERPRISE-ing. - The code that handles external links and requests new windows is very distributed. I think a new module that centralizes all that logic would help.
| export let gFeltPendingURLs = []; | ||
| const FELT_OPEN_DISPOSITION_DEFAULT = 0; | ||
| const FELT_OPEN_DISPOSITION_NEW_WINDOW = 1; | ||
| const FELT_OPEN_DISPOSITION_NEW_PRIVATE_WINDOW = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's export these flags here and import them wherever needed (e.g. in browser/base/content/nonbrowser-mac.js and browser/extensions/felt/api.js). Maybe also wrap them in an enum?
export const FELT_OPEN_WINDOW_DISPOSITION = {
DEFAULT : 0,
NEW_WINDOW : 1,
NEW_PRIVATE_WINDOW : 2,
}
| // Make sure that when FeltUI is requested, we do not try to open another | ||
| // window. Instead, forward any URLs to be opened in the real Firefox. | ||
| if (Services.felt.isFeltUI()) { | ||
| if (isFeltUI) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we delcare isFeltUI closer to its usage? Or actually, since it's only used once, we could generally drop the variable and call Services.felt.isFeltUI(); directly.
| ); | ||
| queueURL(payload); | ||
| } catch (err) { | ||
| gFeltPendingURLs.push(payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also leave a log message console.warn(`Retrying to queue url ${payload.url} after initial failure.`);
Extend the URL opening IPC with a flag indicating where to open things.
Prevent users from triggering new window/private window actions before Firefox is ready by implementing platform-native blocking: - macOS: Grey out dock menu items until ready - Windows: Block jump list until ready (uses existing blockJumpList mechanism) - Linux: Show notification when action is queued before ready Adds felt-firefox-window-ready observer notification that fires when both firefoxReady and extensionReady are true.
Move the pending URL queue (gFeltPendingURLs), disposition constants (FELT_OPEN_WINDOW_DISPOSITION), and queueFeltURL function from BrowserContentHandler.sys.mjs into a dedicated FeltURLHandler.sys.mjs module. This improves code organization and makes the URL handling logic more maintainable. Update all consumers to import from the new module location.
bc95e58 to
513bfe7
Compare
Extend the URL opening IPC with a flag indicating where to open things.